package leetcode;

public class Leetcode303 {
    class NumArray {
        int[] help;
        public NumArray(int[] nums) {
            if(nums==null){
                help = null;
            }
            help = new int[nums.length+1];
            help[0] = 0;
            for (int i = 1; i < help.length; i++) {
                help[i] = help[i-1]+nums[i-1];
            }
        }

        public int sumRange(int i, int j) {
            return help[j+1] - help[i];
        }
    }
}
